﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Welcome : System.Web.UI.Page
{

    public double UserID = 0;
    public string EmailID = "";
    public string Name = "";

    
    protected void Page_Load(object sender, EventArgs e)
{
    if (Session["FullName"].ToString() != "" || Session["UserID"].ToString() != "" || Session["EmailID"].ToString() != "")
    {
        Name = Session["FullName"].ToString();
        UserID = Convert.ToDouble(Session["UserID"].ToString());
        EmailID = Session["EmailID"].ToString();

    }
    else
    {
        Response.Redirect("frmLogin.aspx");
    }

    string StrSql = "select * from registration where UserID = " + UserID;
    DataTable dtbl = SocialKlee.BusinessLogicLayer.BOLyer.GetDataTable(StrSql);
    if (dtbl.Rows.Count > 0)
    {
        Firstname.Text = dtbl.Rows[0]["FirstName"].ToString();
        Lastname.Text = dtbl.Rows[0]["LastName"].ToString();
        City.Text = dtbl.Rows[0]["City"].ToString();
        Address.Text = dtbl.Rows[0]["Address1"].ToString();
        Address1.Text = dtbl.Rows[0]["Address2"].ToString();
        DOB.Text = dtbl.Rows[0]["DOB"].ToString();
        State.Text = dtbl.Rows[0]["State"].ToString();
        Country.Text = dtbl.Rows[0]["Country"].ToString();
        Zipcode.Text = dtbl.Rows[0]["zipcode"].ToString();
        Phone.Text = dtbl.Rows[0]["Phone"].ToString();
        CSUEmailID.Text = dtbl.Rows[0]["CSUEmail"].ToString();
        Gender.SelectedValue = dtbl.Rows[0]["Sex"].ToString();

    }

}
   

    protected void BtnUpdate_Onclick(object sender, EventArgs e)
    {
        string[] NameField = new string[13];
        string[] ValueField = new string[13];

        NameField[0] = "@FirstName";
        NameField[1] = "@LastName";
        NameField[2] = "@Sex";
        NameField[3] = "@DateOfBirht";
        NameField[4] = "@Address";
        NameField[5] = "@Address1";
        NameField[6] = "@City";
        NameField[7] = "@State";
        NameField[8] = "@Country";
        NameField[9] = "@ZipCode";
        NameField[10] = "@Phone";
        NameField[11] = "@CSUEmail";
        NameField[12] = "@UserID";

        ValueField[0] = Firstname.Text;
        ValueField[1] = Lastname.Text;
        ValueField[2] = Gender.SelectedValue.ToString();
        ValueField[3] = DOB.Text;
        ValueField[4] = Address.Text;
        ValueField[5] = Address1.Text;
        ValueField[6] = City.Text;
        ValueField[7] = State.Text;
        ValueField[8] = Country.Text;
        ValueField[9] = Zipcode.Text;
        ValueField[10] = Phone.Text;
        ValueField[11] = CSUEmailID.Text;
        ValueField[12] = UserID.ToString();
        string success = SocialKlee.BusinessLogicLayer.BOLyer.ExecuteStoreProcedure("SocialKlee_UpdateProfiles", NameField, ValueField);


    }


}